/*
===========================================================================
This source file is part of DyLab (Dynamic Laboratory)
For the latest info, see http://dylab.googlecode.com

Copyright (c) 2006-2008 Lukas Krejci
(krejci.lukas@volny.cz)

This file is part of DyLab.

    DyLab is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    DyLab is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with DyLab.  If not, see <http://www.gnu.org/licenses/>.
===========================================================================
*/

#ifndef __dylab_IMassPointsStructure_h__
#define __dylab_IMassPointsStructure_h__

//===========================================================================================
#include <dylab/simobject/ComModelStructure.h>
#include <dylab/simobject/masspoints/MassPoint.h>

//===========================================================================================
namespace dylab {

    /** This class defines the interface for mass points model structure representation.
	*/
    class DYLAB_EXPORT IMassPointsStructure
		: virtual public ComModelStructure::IStructure
    {
    public:

		/**  Create the specified number of mass points.
		@param[in] _count
			Number of requested mass points that should be created.
		@returns
			ID of the first mass point.
			IDs of the next mass points increases on each step by one.
	    */
        virtual MassPoint::id_t createMassPoints(uint32_t _count) = 0;

		/** Returns mass point iterator.
	    */
        virtual MassPointContainer::Iterator massPointIterator() = 0;

		/** Returns mass point iterator, const version.
	    */
        virtual MassPointContainer::ConstIterator massPointIterator() const = 0;

		/** Returns mass point reader.
	    */
        virtual MassPointContainer::Reader massPointReader() const = 0;

		/** Performs any necessary tasks to prepare the mass points for rendering.
	    */
        virtual void prepareForRendering() = 0;

		/** Returns ID of the mass point that lies nearest to the given location.
		@param[in] _pos
			The target location.
	    */
        virtual MassPoint::id_t getNearestMassPointId(const Vector3 & _pos) = 0;

		/** Ensures, that the mass points can hold 
			at least the specified number of history states.
		@param[in] _noStates
			The number of requested history states
	    */
		virtual void reserveHistoryStates(uint32_t _noStates) = 0;

		/** Applies the magnet force on all mass points.
		@remarks
			The force is pointing toward the specified magnet,
			acts on all mass points in the given radius
			and is controlled by the coefficient and attenuation exponent.
		@param[in] _magnet
			Location of the magnet point.
		@param[in] _radius
			Radius defines the boundary of the magnet force effect.
		@param[in] _forceCoeff
			The magnet force coefficient.
		@param[in] _attenuationExp
			The manget force attenuation exponent.
	    */
		virtual void applyPointMagnetForce(const Vector3 & _magnet, real_t _radius, 
			real_t _forceCoeff, real_t _attenuationExp) = 0;

		/** Applies the magnet force on all mass points.
		@remarks
			The force is pointing toward the specified magnet,
			acts on all mass points in the given radius
			and is controlled by the coefficient and attenuation exponent.
		@param[in] _massPointId
			Location of the magnet point defined using one of the mass points.
		@param[in] _radius
			Radius defines the boundary of the magnet force effect.
		@param[in] _forceCoeff
			The magnet force coefficient.
		@param[in] _attenuationExp
			The manget force attenuation exponent.
	    */
        virtual void applyPointMagnetForce(MassPoint::id_t _massPointId, real_t _radius, 
			real_t _forceCoeff, real_t _attenuationExp) = 0;	
    };
}
//===========================================================================================
#endif // __dylab_IMassPointsStructure_h__
